﻿@model EquipmentStockModel

@Html.ValidationSummary(false)
@Html.HiddenFor(model => model.Id)
@Html.HiddenFor(model => model.EquipmentId)

<div class="content">
    <div class="form-horizontal">
        <div class="nav-tabs-custom">
            <div class="tab-content">
                <div class="panel-group">
                    <div class="panel panel-default">
                        <div class="panel-body">
                            <div class="form-group">
                                <div class="col-md-3">
                                    巡检点
                                </div>
                                <div class="col-md-9">
                                    @Html.NopDropDownListFor(model => model.PlaceId, Model.AvailablePlaces)
                                    @Html.ValidationMessageFor(model => model.PlaceId)
                                </div>
                            </div>

                            <div class="form-group advanced-setting">
                                <div class="col-md-3">
                                    具体位置
                                </div>
                                <div class="col-md-9">
                                    @Html.NopEditorFor(model => model.Location)
                                    @Html.ValidationMessageFor(model => model.Location)
                                </div>
                            </div>

                            <div class="form-group">
                                <div class="col-md-3">
                                    名称
                                </div>
                                <div class="col-md-9">
                                    @Html.NopDisplayFor(model => model.Name)
                                </div>
                            </div>

                            <div class="form-group advanced-setting">
                                <div class="col-md-3">
                                    品牌
                                </div>
                                <div class="col-md-9">
                                    @Html.NopDisplayFor(model => model.Manufacturer)
                                </div>
                            </div>

                            <div class="form-group advanced-setting">
                                <div class="col-md-3">
                                    规格型号
                                </div>
                                <div class="col-md-9">
                                    @Html.NopDisplayFor(model => model.Specification)
                                </div>
                            </div>

                            @*<div class="form-group">
                                <div class="col-md-3">
                                    单价
                                </div>
                                <div class="col-md-9">
                                    @Html.NopEditorFor(model => model.Price)
                                    @Html.ValidationMessageFor(model => model.Price)
                                </div>
                            </div>*@

                            <div class="form-group">
                                <div class="col-md-3">
                                    数量
                                </div>
                                <div class="col-md-9">
                                    @*@Html.NopEditorFor(model => model.Amount)
        @Html.ValidationMessageFor(model => model.Amount)*@
                                    @Html.NopDisplayFor(model => model.Amount)
                                    @Html.HiddenFor(model => model.Amount)
                                </div>
                            </div>

                            <div class="form-group">
                                <div class="col-md-3">
                                    开始时间
                                </div>
                                <div class="col-md-9">
                                    @Html.NopEditorFor(model => model.StartOn)
                                    @Html.ValidationMessageFor(model => model.StartOn)
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    $(document).ready(function() {
    $("#@Html.FieldIdFor(model => model.PlaceId)").change(function () {
        var selectedItem = $(this).val();
        var l = $("#@Html.FieldIdFor(model => model.Location)");
        $.ajax({
            cache: false,
            type: "GET",
            url: "@(Url.Action("GetLocationById", "Place"))",
            data: { "pid": selectedItem },
            success: function (data) {
                l.val(data);
            },
            error: function(xhr, ajaxOptions, thrownError) {
                alert('Failed to retrieve states.');
            }
        });
    });
    });
</script>
